home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
mm
/
exec.c.D
< prev
next >
Wrap
Text File
|
1990-07-25
|
8KB
|
262 lines
*** /tmp/,RCSt1022399 Wed Jul 25 13:59:41 1990
--- exec.c Mon Jul 23 16:16:34 1990
***************
*** 14,22 ****
! #include "../h/const.h"
! #include "../h/type.h"
! #include "../h/callnr.h"
! #include "../h/error.h"
! #include "../h/stat.h"
! #include "const.h"
! #include "glo.h"
#include "mproc.h"
--- 14,18 ----
! #include "mm.h"
! #include <sys/stat.h>
! #include <minix/callnr.h>
#include "mproc.h"
***************
*** 24,26 ****
--- 20,26 ----
+ #if INTEL_32BITS
+ #define MAGIC 0x10000301L
+ #else
#define MAGIC 0x04000301L /* magic number with 2 bits masked off */
+ #endif
#define SEP 0x00200000L /* value for separate I & D */
***************
*** 32,35 ****
! #ifdef ATARI_ST
! PUBLIC long lseek();
#endif
--- 32,40 ----
! FORWARD void load_seg();
! FORWARD int new_mem();
! FORWARD void patch_ptr();
! FORWARD int read_header();
!
! #if (CHIP == M68000)
! FORWARD int relocate();
#endif
***************
*** 48,52 ****
int m, r, fd, ft;
! char mbuf[MAX_ISTACK_BYTES]; /* buffer for stack and zeroes */
union u {
! char name_buf[MAX_PATH]; /* the name of the file to exec */
char zb[ZEROBUF_SIZE]; /* used to zero bss */
--- 53,57 ----
int m, r, fd, ft;
! char mbuf[ARG_MAX]; /* buffer for stack and zeroes */
union u {
! char name_buf[PATH_MAX];/* the name of the file to exec */
char zb[ZEROBUF_SIZE]; /* used to zero bss */
***************
*** 63,66 ****
stk_bytes = (vir_bytes) stack_bytes;
! if (stk_bytes > MAX_ISTACK_BYTES) return(ENOMEM); /* stack too big */
! if (exec_len <= 0 || exec_len > MAX_PATH) return(EINVAL);
--- 68,71 ----
stk_bytes = (vir_bytes) stack_bytes;
! if (stk_bytes > ARG_MAX) return(ENOMEM); /* stack too big */
! if (exec_len <= 0 || exec_len > PATH_MAX) return(EINVAL);
***************
*** 78,80 ****
sc = (stk_bytes + CLICK_SIZE - 1) >> CLICK_SHIFT;
! m = read_header(fd, &ft, &text_bytes, &data_bytes, &bss_bytes, &tot_bytes, &sym_bytes, sc);
if (m < 0) {
--- 83,86 ----
sc = (stk_bytes + CLICK_SIZE - 1) >> CLICK_SHIFT;
! m = read_header(fd, &ft, &text_bytes, &data_bytes, &bss_bytes,
! &tot_bytes, &sym_bytes, sc);
if (m < 0) {
***************
*** 113,115 ****
load_seg(fd, D, data_bytes);
! #ifdef ATARI_ST
if (lseek(fd, sym_bytes, 1) < 0)
--- 119,121 ----
load_seg(fd, D, data_bytes);
! #if (CHIP == M68000)
if (lseek(fd, sym_bytes, 1) < 0)
***************
*** 122,131 ****
/* Take care of setuid/setgid bits. */
! if (s_buf.st_mode & I_SET_UID_BIT) {
! rmp->mp_effuid = s_buf.st_uid;
! tell_fs(SETUID, who, (int) rmp->mp_realuid, (int) rmp->mp_effuid);
}
- if (s_buf.st_mode & I_SET_GID_BIT) {
- rmp->mp_effgid = s_buf.st_gid;
- tell_fs(SETGID, who, (int) rmp->mp_realgid, (int) rmp->mp_effgid);
- }
--- 128,139 ----
/* Take care of setuid/setgid bits. */
! if ((rmp->mp_flags & TRACED) == 0) { /* suppress if tracing */
! if (s_buf.st_mode & I_SET_UID_BIT) {
! rmp->mp_effuid = s_buf.st_uid;
! tell_fs(SETUID, who, (int) rmp->mp_realuid, (int) rmp->mp_effuid);
! }
! if (s_buf.st_mode & I_SET_GID_BIT) {
! rmp->mp_effgid = s_buf.st_gid;
! tell_fs(SETGID, who, (int) rmp->mp_realgid, (int) rmp->mp_effgid);
! }
}
***************
*** 136,138 ****
new_sp = (char *) vsp;
! sys_exec(who, new_sp);
return(OK);
--- 144,146 ----
new_sp = (char *) vsp;
! sys_exec(who, new_sp, rmp->mp_flags & TRACED);
return(OK);
***************
*** 144,146 ****
*===========================================================================*/
! PRIVATE int read_header(fd, ft, text_bytes, data_bytes, bss_bytes, tot_bytes, sym_bytes, sc)
int fd; /* file descriptor for reading exec file */
--- 152,155 ----
*===========================================================================*/
! PRIVATE int read_header(fd, ft, text_bytes, data_bytes, bss_bytes,
! tot_bytes, sym_bytes, sc)
int fd; /* file descriptor for reading exec file */
***************
*** 171,180 ****
* 7: size of symbol table in bytes
! #ifdef i8088
! * The longs are represented low-order byte first and high-order byte last.
! * The first byte of the header is always 0x01, followed by 0x03.
! #endif
! #ifdef ATARI_ST
! * The longs are represented high-order byte first and low-order byte last.
! * The third byte of the header is always 0x03, followed by 0x01.
! #endif
* The header is followed directly by the text and data segments, whose sizes
--- 180,183 ----
* 7: size of symbol table in bytes
! * The longs are represented in a machine dependent order,
! * little-endian on the 8088, big-endian on the 68000.
* The header is followed directly by the text and data segments, whose sizes
***************
*** 196,198 ****
if (*ft != SEPARATE) {
! #ifndef ATARI_ST
/* If I & D space is not separated, it is all considered data. Text=0 */
--- 199,201 ----
if (*ft != SEPARATE) {
! #if (CHIP != M68000)
/* If I & D space is not separated, it is all considered data. Text=0 */
***************
*** 252,256 ****
phys_clicks new_base;
! extern phys_clicks alloc_mem();
! extern phys_clicks max_hole();
! #ifdef ATARI_ST
phys_clicks base, size;
--- 255,257 ----
phys_clicks new_base;
! #if (CHIP == M68000)
phys_clicks base, size;
***************
*** 283,285 ****
rmp = mp;
! #ifndef ATARI_ST
old_clicks = (phys_clicks) rmp->mp_seg[S].mem_len;
--- 284,286 ----
rmp = mp;
! #if (CHIP != M68000)
old_clicks = (phys_clicks) rmp->mp_seg[S].mem_len;
***************
*** 301,303 ****
rmp->mp_seg[S].mem_phys = rmp->mp_seg[D].mem_phys + data_clicks + gap_clicks;
! #ifdef ATARI_ST
rmp->mp_seg[T].mem_vir = rmp->mp_seg[T].mem_phys;
--- 302,304 ----
rmp->mp_seg[S].mem_phys = rmp->mp_seg[D].mem_phys + data_clicks + gap_clicks;
! #if (CHIP == M68000)
rmp->mp_seg[T].mem_vir = rmp->mp_seg[T].mem_phys;
***************
*** 310,312 ****
#endif
! #ifdef ATARI_ST
sys_fresh(who, rmp->mp_seg, (phys_clicks)(data_bytes >> CLICK_SHIFT),
--- 311,313 ----
#endif
! #if (CHIP == M68000)
sys_fresh(who, rmp->mp_seg, (phys_clicks)(data_bytes >> CLICK_SHIFT),
***************
*** 342,345 ****
*===========================================================================*/
! PRIVATE patch_ptr(stack, base)
! char stack[MAX_ISTACK_BYTES]; /* pointer to stack image within MM */
vir_bytes base; /* virtual address of stack base inside user */
--- 343,346 ----
*===========================================================================*/
! PRIVATE void patch_ptr(stack, base)
! char stack[ARG_MAX]; /* pointer to stack image within MM */
vir_bytes base; /* virtual address of stack base inside user */
***************
*** 359,361 ****
while (flag < 2) {
! if (ap >= (char **) &stack[MAX_ISTACK_BYTES]) return; /* too bad */
if (*ap != NIL_PTR) {
--- 360,362 ----
while (flag < 2) {
! if (ap >= (char **) &stack[ARG_MAX]) return; /* too bad */
if (*ap != NIL_PTR) {
***************
*** 375,377 ****
*===========================================================================*/
! PRIVATE load_seg(fd, seg, seg_bytes)
int fd; /* file descriptor to read from */
--- 376,378 ----
*===========================================================================*/
! PRIVATE void load_seg(fd, seg, seg_bytes)
int fd; /* file descriptor to read from */
***************
*** 396,398 ****
while (seg_bytes) {
! bytes = 16*1024; /* could be 32767 */
if (seg_bytes < bytes)
--- 397,399 ----
while (seg_bytes) {
! bytes = 31*1024; /* <= 32767 */
if (seg_bytes < bytes)
***************
*** 406,408 ****
! #ifdef ATARI_ST
/*===========================================================================*
--- 407,409 ----
! #if (CHIP == M68000)
/*===========================================================================*
***************
*** 443,445 ****
p = buf;
! n = read(fd, p, MAX_ISTACK_BYTES);
if (n < sizeof(long))
--- 444,446 ----
p = buf;
! n = read(fd, p, ARG_MAX);
if (n < sizeof(long))
***************
*** 457,459 ****
p = buf;
! n = read(fd, p, MAX_ISTACK_BYTES);
if (--n < 0)
--- 45